﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows;
using System.Windows.Controls;
using ESRI.ArcGIS.Client.Geometry;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for TroubleTicketPinTest and is intended
    ///to contain all TroubleTicketPinTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TroubleTicketPinTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Y
        ///</summary>
        [TestMethod()]
        public void YTest()
        {
            TroubleTicket troubleTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(222, 333); 
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);
            int actual;
            actual = target.Y;
            Assert.AreEqual(screenPoint.Y, actual, "Setting Y coordinate failed");
        }

        /// <summary>
        ///A test for X
        ///</summary>
        [TestMethod()]
        public void XTest()
        {
            TroubleTicket troubleTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(222, 333);
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);
            int actual;
            actual = target.X;
            Assert.AreEqual(screenPoint.X, actual, "Setting X coordinate failed");
        }

        /// <summary>
        ///A test for TroubleTicket
        ///</summary>
        [TestMethod()]
        public void TroubleTicketTest()
        {
            MapPoint mp = new MapPoint(777, 888);
            TroubleTicket troubleTicket = new TroubleTicket(mp, "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(123, 456);
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);
            TroubleTicket actual;
            actual = target.TroubleTicket;
            Assert.AreEqual("SampleTicket", actual.Description, "Setting Description failed");
            Assert.AreEqual(777, actual.MapCoordinate.X, "Setting map coordinate failed");
            Assert.AreEqual(888, actual.MapCoordinate.Y, "Setting map coordinate failed");
        }

        /// <summary>
        ///A test for ToolTipAlreadyOpened
        ///</summary>
        [TestMethod()]
        public void ToolTipAlreadyOpenedTest()
        {
            TroubleTicket troubleTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(123, 456);
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);
            bool actual;
            //actual = target.ToolTipAlreadyOpened;
            //Assert.AreEqual(false, actual, "Tooltip should not be open initially");
            
        }
     
        /// <summary>
        ///A test for Description
        ///</summary>
        [TestMethod()]
        public void DescriptionTest()
        {
            TroubleTicket troubleTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(123, 456);
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint); // TODO: Initialize to an appropriate value
            string actual;
            //actual = target.Description;
            //Assert.AreEqual("SampleTicket", actual);
        }

        /// <summary>
        ///A test for Tap
        ///</summary>
        [TestMethod()]
        public void TapTest()
        {
            TroubleTicket troubleTicket = new TroubleTicket(new MapPoint(), "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point screenPoint = new Point(123, 456);
            TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);
            //Assert.IsFalse(target.ToolTipAlreadyOpened, "Tooltip should not be open initially");
            target.Tap();
            //Assert.IsTrue(target.ToolTipAlreadyOpened, "Tooltip should open after tap");
            target.Tap();
            //Assert.IsFalse(target.ToolTipAlreadyOpened, "Tooltip should not be open after another tap");
        }

        /// <summary>
        ///A test for TroubleTicketPin Constructor
        ///</summary>
        [TestMethod()]
        public void TroubleTicketPinConstructorTest()
        {
        //    MapPoint mp = new MapPoint(222, 888);
        //    TroubleTicket troubleTicket = new TroubleTicket(mp, "SampleTicket", "0006789", TroubleTicket.TroubleTicketSeverity.Hight);
        //    Point screenPoint = new Point(987, 654);
        //    TroubleTicketPin target = new TroubleTicketPin(troubleTicket, screenPoint);

        //    Assert.AreEqual(222, target.TroubleTicket.MapCoordinate.X, "Failed to set up Map coordinates properly");
        //    Assert.AreEqual(888, target.TroubleTicket.MapCoordinate.Y, "Failed to set up Map coordinates properly");
        //    Assert.AreEqual(987, target.X, "Failed to set up screen point properly");
        //    Assert.AreEqual(654, target.Y, "Failed to set up screen point properly");
        //    Assert.AreEqual("SampleTicket", target.GetToolTip()., "Failed to set up textblock properly");
        }
    }
}
